/*
package com.jay.base.lambda;

import java.util.ArrayList;
import java.util.Collection;
import java.util.stream.Collectors;
import java.util.stream.Stream;

*/
/**
 * Created by caoyuan7 on 2019/2/21.
 *//*

public class Test {
    public static void main(String args[]){
        Collection<Person> collection = new ArrayList();
        collection.add(new Person("张三", 22, "男"));
        collection.add(new Person("李四", 19, "女"));
        collection.add(new Person("王五", 34, "男"));
        collection.add(new Person("赵六", 30, "男"));
        collection.add(new Person("田七", 25, "女"));

        Stream<Person> personStream =
                collection.stream().filter(
                person -> "男".equals(person.getGender())//只保留男性
        );

        //collection = personStream.collect(Collectors.to);//将Stream转化为List
        collection.forEach(f->System.out.println(f.getName()));
        System.out.println(collection.toString());//查看结果

    }
}
*/
